/* 4.2 while和for语句
 */
#include <stdio.h>

#define PR(fmt, val) printf(#val " = %" #fmt "\t", (val))
#define NL putchar ('\n')

#define PRINT1(f,x1) PR(f,x1), NL
#define PRINT2(f,x1,x2) PR(f,x1), PRINT1(f,x2)
#define PRINT3(f,x1,x2,x3) PR(f,x1), PRINT2(f,x2,x3)
#define PRINT4(f,x1,x2,x3,x4) PR(f,x1), PRINT3(f,x2,x3,x4)

int main()
{
    int x, y, z;

    x=y=0;
    while (y<10) ++y; x += y;
    PRINT2(d,x,y);

    x=y=0;
    while (y<10) x += ++y;
    PRINT2(d,x,y);
    
    y=1;
    while (y<10) {
        x = y++; z = ++y;
    }
    PRINT3(d, x, y, z);
    
    for (y=1; y<10; y++) x=y;
    PRINT2(d, x, y);
    
    for (y=1; (x=y)<10;y++);
    PRINT2(d, x, y);
    
    for (x=0,y=1000;y>1;x++,y/=10)
        PRINT2(d,x,y);
    
    return 0;
}
